﻿using Ninject;

namespace gixoom.Dom.Storage.File
{
    internal class FileStorageFacade: IFileStorageFacade
    {
        private IKernel kernel;

        /// <summary>
        /// Creates FileStorageFacade object.
        /// </summary>
        /// <param name="kernel">kernel</param>
        /// <exception cref="System.ArgumentNullException"><i>kernel</i> is a null reference.</exception>
        public FileStorageFacade(IKernel kernel)
        {
            Ensure.ArgumentNotNull(kernel, "kernel");

            this.kernel = kernel;
        }

        /// <summary>
        /// Creates and returns file storage object.
        /// </summary>
        /// <param name="pathForExtractedFiles">path to folder where extracted files will be stored</param>
        /// <returns>new file storage</returns>
        public IFileStorage CreateFileStorage(string pathForExtractedFiles)
        {
            var fileStorage = kernel.Get<IFileStorage>();
            fileStorage.SetPathForExtractedFiles(pathForExtractedFiles);
            return fileStorage;
        }
    }
}
